package com.umgsai.thread.thread01;

public class MyThread19 extends Thread {

	private String username = "a";
	private String password = "aaa";
	public void setValue(String username, String password) {
		this.username = username;
		if (Thread.currentThread().getName().equals("a")) {
			System.out.println("停止a线程");
			Thread.currentThread().suspend();
		}
		this.password = password;
	}
	
	public void print() {
		System.out.println(username + "-" + password);
	}
	
	public static void main(String[] args) throws InterruptedException {
		final MyThread19 thread = new MyThread19();
		Thread t1 = new Thread(){
			@Override
			public void run() {
				thread.setValue("b", "bbb");
			}
		};
		t1.setName("a");
		t1.start();
		Thread.sleep(500);
		
		Thread t2 = new Thread(){
			@Override
			public void run() {
				thread.print();
			}
		};
		t2.start();
	}
}
